﻿using Rhino.Display;
using Rhino.Geometry;
using System.Drawing;

namespace AiMoInGH.ScriptInstance.Preview
{
    class PreviewStructGeos : PreviewObject
    {
        Line line;
        public PreviewStructGeos(Line line, Color color) : base(color)
        {
            this.line = line;
            ClippingBox = line.BoundingBox;
        }
        public override void Draw(DisplayPipeline display)
        {
            display.DrawLine(line, DrawColor);
        }
    }
    class PreviewPoint : PreviewObject
    {
        Point3d pt;
        public PreviewPoint(Point3d pt, Color color) : base(color)
        {
            this.pt = pt;
            ClippingBox = new BoundingBox(pt, pt + new Vector3d(0.1, 0.1, 0.1));
        }
        public override void Draw(DisplayPipeline display)
        {
            display.DrawPoint(pt, PointStyle.Simple, 3, DrawColor);
        }
    }

    class PreviewPointCloud : PreviewObject
    {
        readonly PointCloud cloud;
        public PreviewPointCloud(PointCloud cloud, Color color) : base(color)
        {
            this.cloud = cloud;
            ClippingBox = cloud.GetBoundingBox(false);
        }

        public override void Draw(DisplayPipeline display)
        {
            display.DrawPointCloud(cloud, 1, DrawColor);
        }
    }

    class PreviewBox : PreviewObject
    {
        Box box;
        public PreviewBox(Box box, Color color) : base(color)
        {
            this.box = box;
            ClippingBox = box.BoundingBox;
        }
        public override void Draw(DisplayPipeline display)
        {
            display.DrawBox(box, DrawColor);
        }
    }

    class PreviewCircle : PreviewObject
    {
        Circle circle;
        public PreviewCircle(Circle circle, Color color) : base(color)
        {
            this.circle = circle;
            ClippingBox = circle.BoundingBox;
        }
        public override void Draw(DisplayPipeline display)
        {
            display.DrawCircle(circle, DrawColor);
        }
    }

    class PreviewArc : PreviewObject
    {
        Arc arc;
        public PreviewArc(Arc arc, Color color) : base(color)
        {
            this.arc = arc;
            ClippingBox = arc.BoundingBox();
        }
        public override void Draw(DisplayPipeline display)
        {
            display.DrawArc(arc, DrawColor);
        }
    }
    class PreviewCone : PreviewObject
    {
        Cone geo;
        public PreviewCone(Cone geo, Color color) : base(color)
        {
            this.geo = geo;
            ClippingBox = new BoundingBox(geo.ApexPoint, geo.ApexPoint);
        }
        public override void Draw(DisplayPipeline display)
        {
            display.DrawCone(geo, DrawColor);
        }
    }

    class DrawCylinder : PreviewObject
    {
        Cylinder geo;
        public DrawCylinder(Cylinder geo, Color color) : base(color)
        {
            this.geo = geo;
            ClippingBox = new BoundingBox(geo.Center, geo.Center + geo.BasePlane.ZAxis * geo.TotalHeight);
        }
        public override void Draw(DisplayPipeline display)
        {
            display.DrawCylinder(geo, DrawColor);
        }
    }
    class DrawSphere : PreviewObject
    {
        Sphere geo;
        public DrawSphere(Sphere geo, Color color) : base(color)
        {
            this.geo = geo;
            ClippingBox = geo.BoundingBox;
        }
        public override void Draw(DisplayPipeline display)
        {
            display.DrawSphere(geo, DrawColor);
        }
    }


}
